home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / PLACEALE.C < prev    next >
Text File  |  1992-05-14  |  1KB  |  48 lines

  1. /************************************************************************************/
  2. /*    PlaceAlert                                                                        */
  3. /*                                                                                    */
  4. /*    Loads the alert template into memory, and resets the value of the bounds rect    */
  5. /*    to position it on the screen.                                                    */
  6. /*                                                                                    */
  7. /************************************************************************************/
  8.  
  9. #include "MyHeaders.h"
  10.  
  11. int PlaceAlert(alrtNo)
  12. {
  13.     int            PARetCode = 0;                            /* set return code            */
  14.     Rect        saveRect;                                /* work area                */
  15.     int            rectHeight;
  16.     int            rectWidth;
  17.     int            newH, newV;
  18.     
  19.     myATmplH = (AlertTemplate **) GetResource ('ALRT', alrtNo);
  20.     if (ResError() != noErr)
  21.         PARetCode = 1;
  22.     else
  23.         {
  24.         HNoPurge(myATmplH);                                /* make not purgeable        */
  25.         saveRect = (**myATmplH).boundsRect;                /* save the current value    */
  26.         rectHeight = saveRect.bottom - saveRect.top;
  27.         rectWidth = saveRect.right - saveRect.left;
  28.  
  29.  
  30.         newH = (screenBits.bounds.right - rectWidth) * .50;        /* new left            */
  31.         if (newH < 9)
  32.             newH = 9;                                            /* not off screen    */
  33.         
  34.         newV = ((screenBits.bounds.bottom - 29 - rectHeight) * (.20)) + 29;    /* top    */
  35.         if (newV < 29)
  36.             newV = 29;                                        /* not into menu bar    */
  37.             
  38.         SetRect (&(**myATmplH).boundsRect, newH, newV,
  39.                 (newH + rectWidth), (newV + rectHeight));
  40.                 
  41.         HPurge (myATmplH);                                    /* make purgeable again    */
  42.         
  43.         CursorSelect (NIL, NIL, NIL);
  44.         }
  45.     
  46.     return PARetCode;
  47. }
  48.